/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mathma.core.vector;

import mathma.core.expr.Expression;

import mathma.core.form.UnaryExpression;

import mathma.core.value.Value;

/**
 * @since 0.2.6
 * @author Ethan Levine
 */
public class UnitVectorExpression<E extends Value>
        extends UnaryExpression<Vector<E>, Vector<E>> {

    public UnitVectorExpression(Expression<Vector<E>> operand) {
        super(Vector.GenericType, operand);
    }

    public Vector<E> evaluate() {
        return getOperand().evaluate().unitVector();
    }

    public UnitVectorExpression<E> newUnaryExpression(
            Expression<Vector<E>> operand) {
        return new UnitVectorExpression<E>(operand);
    }
}
